From 07c4b7969779c3a3208d97794ca6ca58ae413153 Mon Sep 17 00:00:00 2001 From: "kaf24@labyrinth.cl.cam.ac.uk" Date: Sat, 8 Feb 2003 19:32:15 +0000 Subject: [PATCH] bitkeeper revision 1.22.2.8 (3e455b3fL8bm_143DyhEki8VM_GcoQ) apic.c: Removed possible early APIC accesses (before a mapping exists). --- xen-2.4.16/arch/i386/apic.c | 44 ++++++++++++++----------------------- 1 file changed, 16 insertions(+), 28 deletions(-) diff --git a/xen-2.4.16/arch/i386/apic.c b/xen-2.4.16/arch/i386/apic.c index a09613bee4..8cfe52e5d3 100644 --- a/xen-2.4.16/arch/i386/apic.c +++ b/xen-2.4.16/arch/i386/apic.c @@ -204,7 +204,7 @@ extern void __error_in_apic_c (void); */ void __init init_bsp_APIC(void) { - unsigned long value, ver; + unsigned long l, h; /* * Don't do the setup now if we have a SMP BIOS as the @@ -213,32 +213,22 @@ void __init init_bsp_APIC(void) if (smp_found_config || !cpu_has_apic) return; - value = apic_read(APIC_LVR); - ver = GET_APIC_VERSION(value); - - /* - * Do not trust the local APIC being empty at bootup. - */ - clear_local_APIC(); - /* - * Enable APIC. + * Our best bet here is to disable the APIC. This should be safe, as it + * ought to be a uniprocessor box (we tested for an SMP configuration + * already), so we shouldn't be getting interrupt messages in serial-bus + * form from an IO APIC. The APIC will be enabled again later, so don't + * worry :-) Doing the easy thing here should make boot-time more reliable. */ - value = apic_read(APIC_SPIV); - value &= ~APIC_VECTOR_MASK; - value |= APIC_SPIV_APIC_ENABLED; - value |= APIC_SPIV_FOCUS_DISABLED; - value |= SPURIOUS_APIC_VECTOR; - apic_write_around(APIC_SPIV, value); + printk("Disabling local APIC during early boot sequence...\n"); + rdmsr(MSR_IA32_APICBASE, l, h); + l &= ~MSR_IA32_APICBASE_BASE; + wrmsr(MSR_IA32_APICBASE, l, h); - /* - * Set up the virtual wire mode. - */ - apic_write_around(APIC_LVT0, APIC_DM_EXTINT); - value = APIC_DM_NMI; - if (!APIC_INTEGRATED(ver)) /* 82489DX */ - value |= APIC_LVT_LEVEL_TRIGGER; - apic_write_around(APIC_LVT1, value); + /* We should now be in non-APIC mode. */ + l = cpuid_edx(1); + if ( test_bit(X86_FEATURE_APIC, &l) ) BUG(); + clear_bit(X86_FEATURE_APIC, &boot_cpu_data.x86_capability); } void __init setup_local_APIC (void) @@ -401,10 +391,8 @@ static int __init detect_init_APIC (void) wrmsr(MSR_IA32_APICBASE, l, h); } } - /* - * The APIC feature bit should now be enabled - * in `cpuid' - */ + + /* The APIC feature bit should now be enabled in `cpuid' */ features = cpuid_edx(1); if (!(features & (1 << X86_FEATURE_APIC))) { printk("Could not enable APIC!\n"); -- 2.30.2